<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .button {
      }

      .active {
        color: red;
      }

      .page {
        padding: 20px;
        border: 1px solid #000;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <!-- <button @click="curTab = 'Home'" class="button" :class="{ active: curTab === 'Home' }">Home</button>
      <button @click="curTab = 'About'" class="button" :class="{ active: curTab === 'About' }">About</button>
      <button @click="curTab = 'Menu'" class="button" :class="{ active: curTab === 'Menu' }">Menu</button> -->

      <button
        v-for="item in tabs"
        @click="curTab = item"
        :class="{ active: curTab === item }"
      >
        {{ item }}
      </button>
      <hr />
      <div class="page" v-if="curTab === 'Home'">首页</div>
      <div class="page" v-if="curTab === 'About'">关于页</div>
      <div class="page" v-if="curTab === 'Menu'">菜单页</div>
    </div>

    <script src="../../lib/vue3.js"></script>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            // 用于表示当前高亮的Tab
            curTab: "Home",

            tabs: ["Home", "About", "Menu"],
          };
        },
      });

      app.mount("#app");
    </script>
  </body>
</html>
